import { configureStore, ThunkAction, Action } from '@reduxjs/toolkit';
import counterReducer from '../features/counter/counterSlice';
import ordersReducer from '../features/dashboard/domain/ordersSlice';
import positionsReducer from '../features/dashboard/domain/positionsSlice';
import ticksReducer from '../features/dashboard/domain/ticksSlice';
import extremumsReducer from '../features/dashboard/domain/extremumsSlice';

export const store = configureStore({
  reducer: {
    counter: counterReducer,
    orders: ordersReducer,
    positions: positionsReducer,
    ticks: ticksReducer,
    extremums: extremumsReducer,
  },
});

 store.subscribe(() => {
   console.log(store.getState());
 });

export type AppDispatch = typeof store.dispatch;
export type RootState = ReturnType<typeof store.getState>;
export type AppThunk<ReturnType = void> = ThunkAction<
  ReturnType,
  RootState,
  unknown,
  Action<string>
>;
